package org.config.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableEurekaClient
@RestController
@RefreshScope
public class SpringCloudConfigClientApplication {

	public static void main(String[] args) {
		SpringApplication.run(SpringCloudConfigClientApplication.class, args);
	}

	/**
	 * http://localhost:8889/actuator/bus-refresh
	 *
	 * 另外，/actuator/bus-refresh接口可以指定服务，即使用"destination"参数，
	 * 比如 “/actuator/bus-refresh?destination=customers:**” 即刷新服务名为customers的所有服务。
	 */

	@Value("${hello}")
	String hello;

	@GetMapping("/config/hello")
	public String getHelloInfo(){
		return hello;
	}
}

